package com.twu.biblioteca;


public class ListMovie {
    public int PopulateMovieList(Movie VidLib[]){
        VidLib[0]=new Movie("The Shawshank Redemption","Frank Darabont",1994,10);
        VidLib[1]=new Movie("The Godfather","Francis Ford Coppola",1972,9);
        VidLib[2]=new Movie("Psycho","Alfred Hitchcock",1960,9);
        VidLib[3]=new Movie("Pulp Fiction","Quentin Tarantino",1994,10);
        VidLib[4]=new Movie("The Matrix","The Wachowski Brothers",1999,8);
        VidLib[5]=new Movie("Schindler's List","Steven Spielberg",1993,7);
        VidLib[6]=new Movie("The Dark Knight","Christopher Nolan",2008,-1);
        VidLib[7]=new Movie("12 Angry Men","Sidney Lumet",1957,7);
        VidLib[8]=new Movie("Forrest Gump","Robert Zemeckis",1994,6);
        VidLib[9]=new Movie("Redemption","Milos Forman",1994,5);
        VidLib[10]=new Movie("Casablanca","Michael Curtiz",1975,4);
        VidLib[11]=new Movie("Star Wars","George Lucas",1977,3);
        VidLib[12]=new Movie("Fight Club","David Fincher",1999,2);
        VidLib[13]=new Movie("Goodfellas","Martin Scorsese",1990,1);
        VidLib[14]=new Movie("Inception","Christopher Nolan",2010,0);
        return 15;
    }
    public static void Showstar(int rating){
        int Count;
        if(rating>=0)
        {
            for(Count=0;Count<rating;Count++){
            System.out.print("★");
            }
            while (Count<10){
                System.out.print("☆");
                Count++;
            }
        }
        else
            System.out.print("N/A");
       System.out.println();

    }
    public static void Displaylist(Movie VidLib[],int n){
        System.out.print("Movie\t\t\t\t\t\tYear\t\tDirector\t\t\t\tRating\n");
        int Count;
        for (Count=0;Count<n;Count++){
            System.out.print(VidLib[Count].Name);
            Checkdist(VidLib[Count].Name,28);
            System.out.print(VidLib[Count].year);
            System.out.print("\t\t");
            System.out.print(VidLib[Count].Director);
            Checkdist(VidLib[Count].Director,24);
            Showstar(VidLib[Count].rating);
            System.out.println();
        }

    }

    private static void Checkdist(String name,int n) {
        int i;
        for (i=0;i<n-name.length();i++){
        System.out.print(" ");
        }
    }
}
